<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <style>
    .one {
      width: 500px;
      height: 100px;
      background-color: red;
    }

    .two {
      width: 200px;
      height: 100px;
      background-color: white;

      /* 把水平方向的外边距设为 auto(浏览器自适应) 此时就会达到水平居中的效果 */
      margin: 0 auto;


    }
  </style>

  <div class="one">
    <div class="two">

    </div>
  </div>

</body>

</html>